use Switch;

$var = 100;
@array = (10, 20, 30);
%hash = ('key1' => 10, 'key2' => 20);

switch($var){
   case 110          { print "number 100\n"; }
   else				 { print "test\n"}
   case "a"          { print "string a\n" }
   case [1..10,42,100..999]   { print "number in list [1..10,42]\n" }
   case (\@array)    { print "number in list (\@array)\n" }
   case (\%hash)     { print "entry in hash\n" }
   else              { print "previous case not true\n" } #如果前面的都匹配不到那就执行这个语句块
}

